#!/usr/bin/env python
# Decription:
# datetime: 2021-10-13
# Auther: liushiju
# E-mail: 15016234500@139.com
import psutil
import os
import signal

# show system all process
pids = psutil.pids()
for pid in pids:
    p = psutil.Process(pid)
    process_name = p.name()
    print(f"Process name is {process_name}, pid is {pid}")
    if "httpd" == process_name:
        print(f"kill process: {process_name} - {pid}")
        os.kill(pid,signal.SIGKILL)
